﻿using Furion.CMS.Application.Dto;
using Furion.CMS.Domain;
using Mapster;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Furion.CMS.Application.Services.Organization
{
    public class OrganizationProfile : IRegister
    {
        public void Register(TypeAdapterConfig config)
        {
            config.ForType<OrganizationInfo, OrgDto>()
                .Map(dest => dest.Children, src => src.Children.OrderBy(o => o.OrderId)); // 在转换对象时进行排序

            config.ForType<OrganizationInfo, OrgRoleDto>();

            config.ForType<OrganizationInfo, OrgDetailDto>();

            config.ForType<OrgCreateAndUpdateDto, OrganizationInfo>();
        }
    }
}
